package 面试2025.融360;

import java.util.Scanner;

public class 合法IP_nowCoder {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            String str = sc.nextLine();
            boolean flag = judge(str);
            String res = flag == true ? "YES" : "NO";
            System.out.println(res);
        }
    }
    private static boolean judge(String str) {
        String[] splits = str.split("\\.");
        if (splits.length != 4) return false;
        for (int i = 0; i < splits.length; i++) {
            String split = splits[i];
            if ("".equals(split)) {// 面向测试用例编程
                return false;
            }
            int num = Integer.valueOf(split);
            if (num < 0 || num > 255) {
                return false;
            }
            if (String.valueOf(num).length() != split.length()) {
                return false;// 存在前导0
            }
        }
        return true;
    }
}
